package com.dc.dao;

import com.dc.entity.EnergyMonitorEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface EnergyMonitorDao extends JpaRepository<EnergyMonitorEntity, Long>, JpaSpecificationExecutor<EnergyMonitorEntity> {

    public List<EnergyMonitorEntity> findByCompanyId(Long companyId);

    public EnergyMonitorEntity findByCompanyIdAndName(Long companyId, String name);

    @Transactional
    @Modifying
    public void deleteByCompanyId(Long companyId);
}
